<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 比较两个数或对象的 key value 是否一致。 -->
</head>
<body>
  <script>
    let obj1 = {
      name: '张三',
      age: 30,
      sex: '男'
    }
    let obj2 = {
      name: '张三',
      age: 30,
      sex: '男'
    }
    // if(Object.keys(obj1) == Object.keys(obj2)){
    //   alert(true);
    // }else if(Object.values(obj1) == Object.values(obj2)){
    //   alert(true);
    // }else{
    //   alert(false)
    // }
    console.log(JSON.stringify(obj1) == JSON.stringify(obj2));
  </script>
</body>
</html>